package org.qf.cloudorders.controller;


import lombok.RequiredArgsConstructor;
import org.qf.cloudentity.entity.Jifen;
import org.qf.cloudorders.service.JifenApi;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("order")
@RequiredArgsConstructor
public class JifenFeignController {

    // 注入积分服务的接口
    private final JifenApi jifenApi;

    @GetMapping("/testFeign")
    public Map saveJifen() {
        // 订单调用积分服务
        // url = "http://cloud-jifen/jifen/save"
        // Map map = restTemplate.postForObject(url,jifen对象)
        return jifenApi.save(new Jifen(11, 100, "登录送积分"));
    }


}

